<?php
class User
{
	private $login;
	private $password;
	
	/*
	*Log in administrator
	*
	*
	*@param login: request login of administrator
	*@param password: request password of administrator
	*return true && create session variables of authorization || false
	*/
	public function login($login,$password)
	{
		$this->login = $login;
		$this->password = $password;
		if($this->login == ADMIN_LOGIN && 
		   md5($this->password) == ADMIN_PASSWORD)
		{
			$_SESSION['AUTH'] = true;
			$_SESSION['AUTH_LOGIN'] = $this->login;
			return true;
		}
		else
		{
			return false;
		}		
	}
	
	/*
	*Log out administrator
	*
	*
	*destroe session variables of authorization
	*/
	public function logout()
	{
		//Destroy session
		$_SESSION['AUTH'] = '';
		$_SESSION['AUTH_LOGIN'] = '';
		return true;
	}	
}
